/*
 * Powered By dico
 * Since 2017 - 2018
 */package com.seeyoui.kensite.bussiness.orderlang.warehouseProduct.service;
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.seeyoui.kensite.common.base.service.BaseService;

import java.util.*;

import com.seeyoui.kensite.common.base.domain.EasyUIDataGrid;
import com.seeyoui.kensite.common.base.service.BaseService;
import com.seeyoui.kensite.common.exception.CRUDException;
import com.seeyoui.kensite.common.util.*;
import com.seeyoui.kensite.common.constants.StringConstant;
import com.seeyoui.kensite.bussiness.orderlang.product.domain.Product;
import com.seeyoui.kensite.bussiness.orderlang.warehouseProduct.domain.WarehouseProduct;
import com.seeyoui.kensite.bussiness.orderlang.warehouseProduct.domain.WarehouseProductVO;
import com.seeyoui.kensite.bussiness.orderlang.warehouseProduct.persistence.WarehouseProductMapper;

/**
 * WarehouseProduct
 * @author dico
 * @version 2.0
 * @since 1.0
 * @date 2018-02-07
 */

@Service
public class WarehouseProductService extends BaseService {
	
	@Autowired
	private WarehouseProductMapper warehouseProductMapper;
	
	/**
     * 获取商品库存
     * @param warehouseProduct
     * @return
     * @throws CRUDException
     */
    public List<WarehouseProduct> findProductInvertory(Map map) throws CRUDException {
        return warehouseProductMapper.findProductInvertory(map);
    }
    
    public float findQuantityByProductPriceId(String productPriceId){
    	return warehouseProductMapper.findQuantityByProductPriceId(productPriceId);
    }
    
    /**
     * 查询数据集合
     * @param warehouseProduct
     * @return
     */
    public List<WarehouseProductVO> findWarehousProduct(Map map) throws CRUDException {
        return warehouseProductMapper.findWarehousProduct(map);
    }
    
    /**
     * 查询数据总数
     * @param warehouseProduct
     * @return
     * @throws CRUDException
     */
    public int findTotalWarehousProduct(Map map) throws CRUDException {
        return warehouseProductMapper.findTotalWarehousProduct(map);
    }

	/**
	 * 根据ID查询单条数据
	 * @param id
	 * @return
	 * @throws CRUDException
	 */
	public WarehouseProduct findOne(String id) throws CRUDException{
		return warehouseProductMapper.findOne(id);
	}
	
	/**
	 * 查询数据集合
	 * @param warehouseProduct
	 * @return
	 * @throws CRUDException
	 */
	public List<WarehouseProduct> findList(WarehouseProduct warehouseProduct) throws CRUDException {
		return warehouseProductMapper.findList(warehouseProduct);
	}
	
	/**
     * 查询数据集合
     * @param warehouseProduct
     * @return
     */
    public List<Product> findListForInventory(Map map) throws CRUDException {
        return warehouseProductMapper.findListForInventory(map);
    }
	
	/**
	 * 查询所有数据集合
	 * @param warehouseProduct
	 * @return
	 * @throws CRUDException
	 */
	public List<WarehouseProduct> findAll(WarehouseProduct warehouseProduct) throws CRUDException {
		return warehouseProductMapper.findAll(warehouseProduct);
	}
	
	/**
	 * 查询数据总数
	 * @param warehouseProduct
	 * @return
	 * @throws CRUDException
	 */
	public int findTotal(WarehouseProduct warehouseProduct) throws CRUDException {
		return warehouseProductMapper.findTotal(warehouseProduct);
	}
	
	/**
     * 查询数据总数
     * @param warehouseProduct
     * @return
     * @throws CRUDException
     */
    public int findTotalForInventory(Map map) throws CRUDException {
        return warehouseProductMapper.findTotalForInventory(map);
    }
	
	/**
	 * 查询数据总数排除当前数据
	 * @param warehouseProduct
	 * @return
	 * @throws CRUDException
	 */
	public int findExTotal(WarehouseProduct warehouseProduct) throws CRUDException {
		return warehouseProductMapper.findExTotal(warehouseProduct);
	}
	
	/**
	 * 数据新增
	 * @param warehouseProduct
	 * @throws CRUDException
	 */
	public void save(WarehouseProduct warehouseProduct) throws CRUDException{
		warehouseProduct.preInsert();
		warehouseProductMapper.save(warehouseProduct);
	}
	
	/**
	 * 数据修改
	 * @param warehouseProduct
	 * @throws CRUDException
	 */
	public void update(WarehouseProduct warehouseProduct) throws CRUDException{
		warehouseProduct.preUpdate();
		warehouseProductMapper.update(warehouseProduct);			
	}
	
	/**
	 * 数据删除
	 * @param listId
	 * @throws CRUDException
	 */
	public void delete(List<String> listId) throws CRUDException {
		warehouseProductMapper.delete(listId);
	}
	
	/**
	 * 数据假删除
	 * @param warehouseProduct
	 * @throws CRUDException
	 */
	public void remove(WarehouseProduct warehouseProduct) throws CRUDException{
		warehouseProduct.preUpdate();
		warehouseProductMapper.remove(warehouseProduct);			
	}
	
}